package com.example.pojo;

import com.example.validator.UserValidGroupOne;
import com.example.validator.UserValidGroupTwo;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * @program: springboot_course
 * @description: Bean参数校验规则划分为两个组
 * @author: ChenZhiXiang
 * @create: 2019-06-11 09:42
 **/
@Data
public class UserByGroup {

    @NotNull(groups = {UserValidGroupOne.class, UserValidGroupTwo.class},message = "用户名不能为空")
    private String name;

    @NotBlank(groups = {UserValidGroupOne.class, UserValidGroupTwo.class}, message = "ERP不能为空")
    @Size(min = 3, groups = {UserValidGroupOne.class, UserValidGroupTwo.class}, message = "ERP长度不能小于3")
    private String erp;

    @Min(value = 22, groups = {UserValidGroupOne.class}, message = "年龄不能低于22岁")
    @Max(value = 35, groups = {UserValidGroupTwo.class}, message = "年龄不能高于35岁")
    private int age;
}
